# Maintainer: Daniel M. Capella <polyzen@archlinux.org>
# Contributor: Mark Foxwell <fastfret79@archlinux.org.uk>
# Contributor: Nicolas Pouillard [https://nicolaspouillard.fr]
# Contributor: seschwar -- contact via Arch Linux forum or AUR
# Contributor: Ian Denhardt <ian@zenhack.net>

pkgname=alot
pkgver=0.10
pkgrel=6
pkgdesc='Terminal-based MUA for the notmuch mail system'
arch=(any)
url=https://github.com/pazz/alot
license=('GPL3')
depends=('desktop-file-utils' 'notmuch' 'python-configobj' 'python-gpgme'
         'python-magic' 'python-twisted' 'python-urwid'
         'python-urwidtrees' 'python-cffi')
makedepends=('python-build' 'python-installer' 'python-wheel' 'python-sphinx')
checkdepends=('procps-ng' 'python-pytest')
source=("$url/archive/$pkgver/alot-$pkgver.tar.gz"
        "alot-$pkgver.tar.gz.asc::$url/releases/download/$pkgver/$pkgver.tar.gz.asc"
        "$pkgname-$pkgver-skip-broken-test.patch")
sha512sums=('b07c77f3a21c9670fb14a760d036ce0e14678dd6ae75585cc929f97db5126a7dbb7f411244d317fea2913692afca6ff9f439f9dbbf047acffb8fcea2ebef7056'
            'SKIP'
            'a30149bb10fa594ec9f57407290157498a7b865909449e92317840907606ffb74a072bc997f5960b077bc42924c077a1a0d52a51069b0e9323e6bdec2abb3b98')
validpgpkeys=('B7838D65FEE80DED1DCA494D94340367D7D6C5AA') # Patrick Totzke

prepare() {
  cd alot-$pkgver

  patch -Np1 < "../$pkgname-$pkgver-skip-broken-test.patch"
}

build() {
  cd alot-$pkgver
  python -m build --wheel --no-isolation
  make -C docs man
}

check() {
  cd alot-$pkgver
  pytest
}

package() {
  cd alot-$pkgver
  python -m installer --destdir="$pkgdir" dist/*.whl
  install -Dm644 -t "$pkgdir"/usr/share/man/man1 docs/build/man/alot.1
  install -Dm644 -t "$pkgdir"/usr/share/applications extra/alot*.desktop
  install -Dm644 extra/completion/alot-completion.zsh \
    "$pkgdir"/usr/share/zsh/functions/_alot
  install -Dm644 -t "$pkgdir"/usr/share/alot/themes \
    extra/themes/{mutt,solarized_light,solarized_dark,sup,tomorrow}
}

# vim:set ts=2 sw=2 et:
